﻿namespace BodaNetCommunications.S7Coms.S7Utils
{
    public class S7DataParameter
    {
        /// <summary>
        /// 分组数据的Id，用于分组后的数据识别
        /// </summary>
        public string Id { get; set; } = Guid.NewGuid().ToString();

        /// <summary>
        /// 存储区
        /// </summary>
        public S7Areas Area { get; set; }

        public ushort DBNumber { get; set; } = 0;

        public S7PValueSize PValueSize { get; set; }

        public S7DValueSize DValueSize { get; set; }// 写入时处理

        public int ByteAddress { get; set; } = 0;
        public byte BitAddress { get; set; } = 0;

        public ushort Count { get; set; } = 1;
        public Type DataType { get; set; }

        /// <summary>
        /// 读的时候，填充返回的结果
        /// 写的时候，填充将写入的数据
        /// </summary>
        public List<object> Datas { get; set; } = new List<object>();

        /// <summary>
        /// 获取原始返回数据的字节数组
        /// </summary>
        public List<byte> RawBytes { get; set; } = new List<byte>();


        public bool Status { get; set; } = true;
        public string? Error { get; set; }
    }
}
